<template>
	<view class="uni-swiper-msg ">
		<view class="uni-swiper-msg-icon">
			<image src="../static/notice.png" mode="widthFix"></image>
		</view>

		<swiper vertical="true" autoplay="true" circular="true" interval="3000">
			<swiper-item v-for="(item, index) in list_" :key="index" @click="navToDetails(item)">
				<navigator>{{item.title}}</navigator>
			</swiper-item>
		</swiper>
	</view>
</template>

<script>
	export default {
		data() {
			return {};
		},
		props: {
			list: {
				type: Array,
				default: () => {
					return []
				}
			}
		},
		computed: {
			list_() {
				return this.list;
			}
		},
		methods: { 
			//新闻详情
			navToDetails(item) {
				let data = {
					id: item.id,
					title: item.title,
					author: item.author,
					time: item.time_text,
					url: item.videoSrc
				}
				let url = item.videoSrc ? 'videoDetails' : 'details';
			
				uni.navigateTo({
					url: `/pages/news/${url}?data=${JSON.stringify(data)}`
				})
			},
		}
	}
</script>

<style scoped> 
	.uni-swiper-msg-icon {
		width: 25px;
		margin-right: 10px;
		margin-left: 10px;
	} 
</style>
